class UserModel {
  final int uid;
  late String username;
  late String password;
  late String nickname;
  late String avator;
  late String gender;
  late int age;
  late String phone;
  late String email;
  late String intro;

  UserModel({
    required this.uid,
    required this.username,
    required this.password,
    required this.nickname,
    required this.avator,
    required this.gender,
    required this.age,
    required this.phone,
    required this.email,
    required this.intro,
  });

  factory UserModel.fromJson(Map<String, dynamic> json) {
    return UserModel(
      uid: json['uid'] ?? 0,
      username: json['username'] ?? '',
      password: json['password'] ?? '',
      nickname: json['nickname'] ?? '',
      avator: json['avator'] ?? 'default',
      gender: json['gender'] ?? 'UNKNOWN',
      age: json['age'] ?? 0,
      phone: json['phone'] ?? '',
      email: json['email'] ?? '',
      intro: json['intro'] ?? '他(她)还未进行自我介绍哦',
    );
  }
}
